﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DbSharp.Framework.CaseFile
{
    /// <summary>
    /// default Resultset output setting class
    /// </summary>
    public class DefaultRsOutputSetting : IResultsetOutputSetting
    {
        #region Private members

        const long CONST_MAX_RECORD_COUNT = long.MaxValue;

        Nullable<long> m_ExportRecordCount = null;
        private bool m_WrapStringByCDATA;
        #endregion

        public string GetFieldOutputName(string fieldName)
        {
            if (string.IsNullOrEmpty(fieldName))
                return string.Empty;
            else
                return fieldName.Trim();
        }


        #region IResultsetOutputSetting Members

        public bool IndicateOutputAllFields
        {
            get { return true; }
        }


        public bool WrapStringByCDATA
        {
            get { return m_WrapStringByCDATA; }
            set { m_WrapStringByCDATA = value; }
        }

        public string OutputArgument { get; private set; }

        public bool OutputAllOutArguments { get { return true; } }

        public long ExportRecordCount
        {
            get
            {
                if (m_ExportRecordCount == null)
                    return CONST_MAX_RECORD_COUNT;
                else
                    return (long)m_ExportRecordCount;
            }
            set
            {
                if (m_ExportRecordCount < 0)
                    m_ExportRecordCount = long.MaxValue;
                else
                    m_ExportRecordCount = value;
            }
        }



        public void AddOutputFieldName(string fieldName, string outputName, string nullValuePlaceHolder)
        {
        }

        /// <summary>
        /// key:UpperCase fieldName 
        /// value: outputFieldName
        /// </summary>
        /// <returns></returns>
        public Dictionary<string, string> GetFieldOutputNamePairs()
        {
            return new Dictionary<string, string>();
        }
 

        public Dictionary<string, string> GetFieldNullPlaceholderPairs()
        {
            return new Dictionary<string, string>();
        }

        #endregion
    }
}
